/*
 * Client.cpp
 *
 *  Created on: 19.11.2013
 *      Author: ulgish
 */

#include "lab5/client/Client.h"
#include <sys/dispatch.h>

std::string Client::sendMsg(const std::string & msg)
{
	bufreply = new char[msg.length() + 1];
	MsgSend(server_coid, msg.c_str(), msg.length() + 1, bufreply, msg.length());
	bufreply[msg.length()] = '\0';
	std::string ret = std::string(bufreply);
	delete []bufreply;
	return ret;

}

Client::Client(const std::string & channelName)
{
	server_coid = name_open(channelName.c_str(), 0);

}

Client::~Client() {
	// TODO Auto-generated destructor stub
	name_close(server_coid);
}
